package thread;

/**
 * @Author: zhanghuan
 * @date: 2020/10/2 15:07
 * @description:
 */
public class TestPriority implements Runnable {

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "------------" + Thread.currentThread().getPriority());
    }

    public static void main(String[] args) {
        System.out.println(Thread.currentThread().getName() + "------------" + Thread.currentThread().getPriority());
        Thread t1 = new Thread(new TestPriority(), "1");
        Thread t2 = new Thread(new TestPriority(), "2");
        Thread t3 = new Thread(new TestPriority(), "3");
        Thread t4 = new Thread(new TestPriority(), "4");
        Thread t5 = new Thread(new TestPriority(), "5");
        Thread t6 = new Thread(new TestPriority(), "6");
       t1.start();
       t2.setPriority(1);
       t2.start();
       t3.setPriority(4);
       t3.start();
       t4.setPriority(Thread.MAX_PRIORITY);
       t4.start();
       t5.setPriority(-1);
       t5.start();

       t6.setPriority(2);
       t6.start();
    }
}
